Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:"",
    content:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  iscture: function (e) {
    var name = e.detail.value
    var that = this;
    console.log(e)
    wx.request({
      url: getApp().AppUrl + 'index.php/api/api/search_like_name',
      method: 'GET',
      data: {
        name: "" + name
      },
      success: function (res) {
        that.setData({
          content: res.data
        })
      },
      
    })
  },
  onLoad: function (options) {
    console.log(options)
    var that = this;
    var name = options.name;
    that.setData({
      name: options.name
    })
    wx.request({
      url: getApp().AppUrl + 'index.php/api/api/search_like_name',
      method: 'GET',
      data: {
        name: "" + name
      },
      success: function (res) {
        console.log(res.data);
        that.setData({
          content: res.data,
          name: name
        })
      }
    })
  },
  loctionAll:function(e){
    var dats = e.target.dataset
    wx.request({
      url: getApp().AppUrl + 'index.php/api/set/save_ct_hot_search',
      method: 'GET',
      data: {
        bangdan_id: "" + dats.id,
        teacase_id: "" + dats.tid,
        teaarea_id: "" + dats.hid,
      },
      success: function (res) {
        console.log(res)
      }
    })
    var d = dats;
    if(d.sid){
      if (d.id === 3) {
        var urls = getApp().Treasures +'?sid=' + d.sid + '&id=' + d.id + '&tid=' + d.tid + '&hid=' + d.hid + '&biaozhi=1' + "&ins= " + d.ins;
      } else if (d.id === 2) {
        var urls = getApp().brand+'?sid=' + d.sid + '&id=' + d.id + '&tid=' + d.tid + '&hid=' + d.hid + '&biaozhi=1' + "&ins= " + d.ins;
      } else {
        var urls = getApp().Craftsman+'?sid=' + d.sid + '&id=' + d.id + '&tid=' + d.tid + '&hid=' + d.hid + '&biaozhi=1' + "&ins= " + d.ins;
      }
    }else{
      var urls = '../Allot/Allot?id=' + d.id + '&hid=' + d.hid + '&tid=' + d.tid
    }
    wx.navigateTo({
      url: urls
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})